package com.travel.photos.ui.otheruser;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.travel.R;
import com.travel.photos.base.BaseActivity;
import com.travel.photos.image.ImageHepler;

import java.util.logging.Logger;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import tools.EndLessOnScrollListener;

/**
 * Created by meidou on 2016/10/24.
 */
public class OtherUserActivity extends BaseActivity implements OtherUserContract.View{


    @Bind(R.id.photo_user_title)
    TextView mPhotoUserTitle;
    @Bind(R.id.toolbar)
    Toolbar mToolbar;
    @Bind(R.id.head_img)
    ImageView mHeadImg;
    @Bind(R.id.sign)
    TextView mSign;
    @Bind(R.id.photo_user_activity_recycle)
    GridView mPhotoUserActivityRecycle;
    private String userid;
    private OtherUserContract.Presenter mPresenter;

    @Override
    public void initViews() {
        setSupportActionBar(mToolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    public void initData() {
        userid = getIntent().getStringExtra("userId");
        String name = getIntent().getStringExtra("name");
        mPhotoUserTitle.setText(name);
        String imageurl = getIntent().getStringExtra("image");
        ImageHepler.showImage(this,imageurl,mHeadImg,true);
        mPresenter= new OtherUserPresenter(this,userid);
        mPresenter.getDetail(this);
    }

    @Override
    public int getLayoutId() {
        return R.layout.photo_user_acticity;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.photo_user_title, R.id.toolbar, R.id.head_img, R.id.sign})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.photo_user_title:
                break;
            case R.id.toolbar:
                break;
            case R.id.head_img:
                break;
            case R.id.sign:
                break;
        }
    }

    @Override
    public void getDetail(OtherUserAdapter adapter) {
        mPhotoUserActivityRecycle.setAdapter(adapter);
    }
}
